#!/usr/bin/env python

import os
import subprocess
import socket
import sys
import time
from struct import *

import paho.mqtt.client as mqtt


def on_connect(mqttc, obj, flags, rc):
    if rc != 0:
        exit(rc)

run = -1
mqttc = mqtt.Client("01-keepalive-pingreq")
mqttc.on_connect = on_connect

mqttc.connect("localhost", 1888, 4)
while run == -1:
    mqttc.loop()

exit(run)
